/*  point.cpp
 * Copyright (C) 2010, Francisco Claude & Patrick Nicholson, all rights reserved.
 *
 * Francisco Claude & Patrick Nicholson <(fclaude|p3nichol)@cs.uwaterloo.ca>
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "point.h"

Point::Point(double x, double y) {
  this->x = x;
  this->y = y;
}

double Point::getRadius() const {
  return 0.0;
}

double Point::getTheta() const {
  return 0.0;
}

double Point::getX() const {
  return x;
}

double Point::getY() const {
  return y;
}

double Point::setX(double x) {
  this->x = x;
  return x;
}

double Point::setY(double y) {
  this->y = y;
  return y;
}

bool PointYCmp::operator()(Point * p1, Point * p2) {
  return p1->getY() <= p2->getY();
}

bool PointXCmpDes::operator()(Point * p1, Point * p2) {
  if( p1->getX() < p2->getX() ) return true;
  if( p1->getX() == p2->getX() && p1->getY() >= p2->getY() ) return true;
  return false;
}

bool PointXCmpAsc::operator()(Point * p1, Point * p2) {
  if( p1->getX() < p2->getX() ) return true;
  if( p1->getX() == p2->getX() && p1->getY() <= p2->getY() ) return true;
  return false;
}

ostream & operator<<(ostream & out, Point * p) {
  out << p->getX() << " " << p->getY() ;
  return out;
}

ostream & operator<<(ostream & out, Point p) {
  out << p.getX() << " " << p.getY() ;
  return out;
}
